<?php
/*
 * @Author: your name
 * @Date: 2020-06-05 17:32:41
 * @LastEditTime: 2020-10-27 14:02:45
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /special/application/api/controller/ProductUpgradeController.php
 */

namespace app\api\controller;

use app\api\service\ProductUpgrade;

//产品升级
class ProductUpgradeController extends BaseController
{
    /**
     * @name 接收新服务端地址通知旧服务端
     * @author wx
     * @date 2020/5/7 16:06
     */
    public function ReceiveUpgrade()
    {
        //接收参数
        $data = base64_decode(file_get_contents("php://input"));
        $data = json_decode($data,true);

        $server = new ProductUpgrade();
        $server->ReceiveUpgrade($data);

        return $this->jsonOutPut();
    }

    /**
     * @name 返回新服务端的客户端安装包地址
     * @author wx
     * @date 2020/5/7 17:04
     */
    public function getInstallPackagePath()
    {
        $data = base64_decode(file_get_contents("php://input"));
        $data = json_decode($data,true);

        $server = new ProductUpgrade();
        $returnData = $server->getInstallPackagePath($data);

        return $this->jsonOutPut($returnData);
    }

    /**
     * @name 安装包结果返回
     * @author wx
     * @date 2020/5/7 17:05
     */
    public function ResultStatus()
    {
        $data = base64_decode(file_get_contents("php://input"));

        if(!empty($data)){
            $data = json_decode($data,true);
        }else{//linux

            $data = input('get.');
        }

        $server = new ProductUpgrade();
        $server->ResultStatus($data);

        return $this->jsonOutPut();
    }


}